<%@page import="com.hcfly.factory.DAOFactory"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.hcfly.vo.Emp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>处理表单</title>
<%request.setCharacterEncoding("utf-8"); 
	response.setHeader("refresh", "3;URL=emp_list.jsp");	// 设置跳转时间为3秒
%>
</head>
<body>
<%
Emp emp = new Emp();
emp.setEmpno(Integer.parseInt(request.getParameter("empno")));
emp.setEname(request.getParameter("ename"));
emp.setJob(request.getParameter("job"));
emp.setHiredate(new SimpleDateFormat("yyyy-MM-dd").parse(request.getParameter("hiredate")));
emp.setSal(Float.parseFloat(request.getParameter("sal")));
try{
	if(DAOFactory.getIEmpDAOInstance().doCreate(emp)){
		out.print("<h3>雇员信息添加成功！</h3>");
	}else{
		out.print("<h3>雇员信息添加失败！</h3>");
	}
}catch(Exception e){
	e.printStackTrace();
}

%>
<h3>3秒后跳转到列表页</h3>
</body>
</html>